/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import db.Redis_Rd;
import java.util.List;
import java.util.ArrayList;
import share.KeysDefinition;

/**
 *
 * @author LinhTA
 */
public class FakeData {

    public static Boolean IsRun = false;
    public static List<String> listUser;

    private FakeData() {
        listUser = getListUsers();
    }

    public static FakeData getInstance() {
        return FakeDataHolder.INSTANCE;
    }

    private static class FakeDataHolder {

        private static final FakeData INSTANCE = new FakeData();
    }

    public static List<String> getListUsers() {
        List<String> list = new ArrayList<String>();

        list.add("243137784");
        list.add("7555590");
        list.add("23885717");
        list.add("391930");
        list.add("468598");
        list.add("1491992");

        return list;
    }

    public static List<String> getFriendsList(String uid) {

        return listUser;
    }

    public static String getName(String uid) {
        
        if(uid.equals("468598"))
            return "Linh";
        else if(uid.equals("243137784"))
            return "Dang Tran";
        else if(uid.equals("7555590"))
            return "Giang Chau";
        else if(uid.equals("23885717"))
            return "Sữa Ông Mặt Trời";
        else if(uid.equals("391930"))
            return "tiengsetmaudo";
        else if(uid.equals("1491992"))
            return "hieubnd";
        else
            return uid;
    }

    public static String getAvata(String uid) {
        String[] avatas = new String[] { "http://1.1.s50.avatar.zdn.vn/avatar_files/5/1/9/3/anhlinhth_50_9.jpg",
                                   "http://b.1.s50.avatar.zdn.vn/avatar_files/b/3/4/6/dangbaotran88_50_0.jpg",
                                   "http://a.1.s50.avatar.zdn.vn/avatar_files/a/6/4/b/alkill_50_18.jpg",
                                   "http://1.1.s50.avatar.zdn.vn/avatar_files/5/6/1/9/acquydem12_50_5.jpg",
                                   "http://1.1.s50.avatar.zdn.vn/avatar_files/1/0/7/2/tiengsetmaudo_50_-1.jpg" };
        
        if(uid.equals("468598"))
            return avatas[0];
        else if(uid.equals("243137784"))
            return avatas[1];
        else if(uid.equals("7555590"))
            return avatas[2];
        else if(uid.equals("23885717"))
            return avatas[3];
        else if(uid.equals("391930"))
            return avatas[4];
        else
            return avatas[ (int)(Math.random() * 5) ];
    }

    public static void setUser() {
        List<String> users = getListUsers();
        for (int i = 0; i < users.size(); i++) {
            UserModel u = new UserModel(users.get(i));
            if( !Redis_Rd.getInstance().isExits(KeysDefinition.getKeyUser(users.get(i))) )
                u.getDataUser();
        }
    }

    public static void main(String[] args) {
        setUser();
    }
}
